Skip to content

Conversation

Zapper9982
Copy link

📋 Description

This pull request introduces a significant number of new unit tests and fixes for existing tests across more than 80 files. The primary motivation is to enhance the overall test coverage of the Common-API service layer, improve code quality, and ensure the reliability of existing and new functionality. The changes address various failing tests and add comprehensive test cases for previously untested code paths.

NOTE :
Some of the extremely huge services which are Admin and CTI do not have a testcase cause of hallucinations will be looked into it with a later PR .

Some of the services have a RestTemplate instantiated within the method and not as a class declaration causing the methods to be rendered non - testable

@vanitha1822


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

The changes were tested by running the full suite of unit tests locally. The focus has been on:

  • Adding new test cases to cover methods and classes that previously had low or no coverage.
  • Fixing existing tests that were failing due to issues like NullPointerException, incorrect mocking, or assertion errors.
  • Ensuring that all new and modified tests pass successfully.

The work spans over 80 files, indicating a widespread effort to improve the test harness of the application.

Screenshots

image image

@drtechie @vanitha1822 Raising a PR , a total of 1705 Testcases are currently written.
Some of the failures are because of :

  • Assertion failures cause of different branches
  • some testcases failing cause of the inability to mock and test RestTemplate .
image

Copy link
Contributor

coderabbitai bot commented Aug 4, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Zapper9982
Copy link
Author

image

56 tests run on CTIServiceImplTest successfully

Zapper9982 and others added 4 commits August 8, 2025 02:18
Release 3.2.1 to main Branch merge
* Fix the issue in fetching the value for fields (PSMRI#257)

* fix: Add jsonProperty to map with the request body to fix the issue in getting the value for income, education and occupation

* fix: remove commented code

* Update version in pom.xml to 3.4.0

* Update pom.xml

* Add ServerAuthorization key in allow headers (PSMRI#275)

* fix: add serverAuthorization

* fix: add console

* fix: correct the spelling

* Nd/vs/token bengen issue (PSMRI#280)

* fix: add useragent as java to skip the token

* fix: add logger

* fix: add logger

---------

Co-authored-by: Vanitha S <116701245+vanitha1822@users.noreply.github.com>
Co-authored-by: Amoghavarsh <93114621+5Amogh@users.noreply.github.com>
Co-authored-by: Mithun James <drtechie@users.noreply.github.com>
if (everwellBenRegListAS != null) {

registerEverWellPatient(everwellBenRegListAS, Authorization);
registerEverWellPatient(everwellBenRegListAS, Authorization, new RestTemplate());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is RestTemplate being passed here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because , since the rest template is being created and used in the function its not testable ... so passing a rest template allows the code to be tested

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another approach could also be that , the rest template could be defined at class level, but I wasnt sure that would be appropriate to do

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zapper9982 Is it really necessary to add this extra parameter to the function? Have you tested whether it will not affect the flow of the application?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vanitha1822 , yes as u can see I have changed all the calls to registereverwellPatient to have the rest template .

Copy link

sonarqubecloud bot commented Sep 3, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants